//
//  WithdrawSuccessViewController.m
//  HTHappySale
//
//  Created by 创维海通 on 2017/9/26.
//  Copyright © 2017年 zxyywy. All rights reserved.
//

#import "WithdrawSuccessViewController.h"
#import "MePurseViewController.h"

//Cell
#import "WithdrawSuccessCell.h"

//Model
#import "MeHTModel.h"

@interface WithdrawSuccessViewController ()<UITableViewDelegate,UITableViewDataSource,WithdrawSuccessDelegate>
@property (strong, nonatomic) IBOutlet UITableView *SuccessTableView;
@property (strong, nonatomic) MeWithdrawSuccessModel *successModel;

@end

@implementation WithdrawSuccessViewController
#pragma mark -init
#define WithdrawSuccessIdentifyCell  @"WithdrawSuccessCell"

- (instancetype)init:(MeWithdrawSuccessModel *)model
{
    if (self = [super init]) {
        _successModel = [[MeWithdrawSuccessModel alloc] init];
        _successModel = model;
    }
    return self;
}

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view from its nib.
    
    
    //Xib
    UINib *xib = [UINib nibWithNibName:NSStringFromClass([WithdrawSuccessCell class])
                                       bundle:[NSBundle mainBundle]];
    [self.SuccessTableView registerNib:xib forCellReuseIdentifier:WithdrawSuccessIdentifyCell];
    
    [self initTableView];
}

- (void)viewWillAppear:(BOOL)animated
{
    [super viewWillAppear:animated];
    [self addNavigationLeftView:@"" andType:0];
    [self addNavigationMiddleView:@"提现"];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

- (void)initTableView
{
    _SuccessTableView.tableFooterView = [[UIView alloc] init];
    _SuccessTableView.separatorStyle = UITableViewCellSeparatorStyleNone;
    _SuccessTableView.scrollEnabled = NO;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    if(_successModel != nil)
    {
        return 1;
    }
    return 0;
}

#define cellIdentify @"cell"
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    WithdrawSuccessCell *withdrawSuccessCell = [tableView dequeueReusableCellWithIdentifier:WithdrawSuccessIdentifyCell];
    [withdrawSuccessCell configureCell:_successModel];
    withdrawSuccessCell.selectionStyle = UITableViewCellSelectionStyleNone;
    withdrawSuccessCell.suceessDeleate = self;
    
    return withdrawSuccessCell;
}

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
    return 255;
}

- (CGFloat)tableView:(UITableView *)tableView estimatedHeightForRowAtIndexPath:(NSIndexPath *)indexPath
{
    return 255;
}

- (void)goBackController
{
    NSArray *controllerArr = [self.navigationController viewControllers];
    for (UIViewController *controller in controllerArr) {
        if ([controller isKindOfClass:[MePurseViewController class]]) {
            [self.navigationController popToViewController:controller animated:YES];
        }
    }
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
